
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>MyBatis如何使用储存过程 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>MyBatis如何使用储存过程 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">什么是存储过程？它对应用程序开发有何帮助？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">存储过程是能完成一定操作的一组SQL语句集合。它能够简化客户端应用程序的开发和维护，并且可以提高应用程序的运行性能。例如，当需要对插入的数据进行复杂验证时，可以使用存储过程来封装这些逻辑。</div>
          </div>
          <div class="card-source">来源: 储存过程是什么？</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">与将SQL语句放在应用程序中相比，存储过程在编译和执行效率方面有什么优势？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">存储过程保存在数据库中，只需要编译一次就可以被反复直接执行。而放在项目中的SQL语句，例如在同一个Mapper方法中，如果被调用10次，就需要编译10次，效率较低。</div>
          </div>
          <div class="card-source">来源: 储存过程的优势</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">使用MyBatis框架调用存储过程需要哪三个核心步骤？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">使用MyBatis调用存储过程的核心步骤包括：1. 在数据库中创建存储过程；2. 在MyBatis的Mapper XML文件中定义调用存储过程的SQL语句；3. 在Java代码中调用MyBatis的接口方法来执行存储过程。</div>
          </div>
          <div class="card-source">来源: MyBatis调用储存过程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在MyBatis Mapper XML中配置存储过程调用时，`statementType`属性应该设置为什么值？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在MyBatis的Mapper XML文件中定义调用存储过程的SQL语句时，`statementType`属性必须设置为`CALLABLE`。</div>
          </div>
          <div class="card-source">来源: MyBatis调用储存过程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">在MyBatis中调用存储过程时，如何定义输入（IN）和输出（OUT）参数？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在参数中通过`mode`属性来定义。例如，`#{userId, mode=IN, jdbcType=INTEGER}`定义了一个输入参数，而`#{userName, mode=OUT, jdbcType=VARCHAR}`定义了一个输出参数。</div>
          </div>
          <div class="card-source">来源: MyBatis调用储存过程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">请写出在MyBatis Mapper中调用存储过程的基本语法格式。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">基本语法格式是使用花括号将调用语句包裹起来，以`call`关键字开头，后接存储过程名称和参数列表。例如：`{call get_user_by_id(#{userId, mode=IN}, #{userName, mode=OUT})}`。</div>
          </div>
          <div class="card-source">来源: MyBatis调用储存过程</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
